home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1988 March & April / rerun-1988-03-04.d64 / home inv. 64 (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  5.0 KB  |  226 lines

  1. 0 rem home inventory 64 - ian adam
  2. 10 nf$="none"
  3. 20 print"[147] * home inventory by ian adam"
  4. 30 print""
  5. 40 print"file name:",nf$
  6. 50 print"total rooms   ",nr
  7. 60 print"items per room",ni
  8. 70 print"items entered ",ci
  9. 80 print"the main menu"
  10. 90 sa=7:k=198:m$(0)="end"
  11. 100 m$(1)="create file"
  12. 110 m$(2)="get file from disk"
  13. 120 m$(3)="work on data"
  14. 130 m$(4)="save to disk"
  15. 140 m$(5)="printed report"
  16. 150 for i=0 to 5
  17. 160 printi;m$(i):next
  18. 170 print"choice?":wait k,7
  19. 171 get a$:ifa$="" then 171
  20. 172 a=val(a$)
  21. 180 print:print"[147]"m$(a)
  22. 190 if a>2 and nr=0 then input"no data!";a$:run
  23. 200 if a>2 or nr=0 then 220
  24. 210 print"are you sure? y/n":wait k,7:get a$:if a$<"y" then 20
  25. 220 on a+1 gosub 230,690,250,820,410,1690:goto 20
  26. 230 end
  27. 240 :
  28. 250 clr:d$=",s,r"
  29. 260 gosub 560:if a>19 then run
  30. 270 input#1,a,b
  31. 280 print"file "nf$" allows"a
  32. 290 print"rooms, &"b"items per room."
  33. 300 print"press return if ok, or enter:"
  34. 310 i=a:j=b:gosub 740
  35. 320 :
  36. 330 for i=1 to a
  37. 340 input#1,nr$(i),ir(i)
  38. 350 for j=1 to ir(i)
  39. 360 input#1,it$(i,j),id$(i,j),ag(i,j),nv(i,j),pv(i,j)
  40. 370 next:if j>ni then ir(i)=ni
  41. 380 next
  42. 390 gosub 520:gosub 1650:goto 20
  43. 400 :
  44. 410 print"press return for: "nf$
  45. 420 d$=",s,w"
  46. 430 gosub 560:if a>19 then return
  47. 440 print#1,nr:print#1,ni:b$=" "
  48. 450 for i=1 to nr
  49. 460 print#1,b$+nr$(i):print#1,ir(i)
  50. 470 for j=1 to ir(i)
  51. 480 print#1,b$+it$(i,j):print#1,b$+id$(i,j)
  52. 490 print#1,ag(i,j):print#1,nv(i,j):print#1,pv(i,j)
  53. 500 next:next
  54. 510 :
  55. 520 close1:input#2,a,b$:close2
  56. 530 if a>19 then print"problem: "b$:input"return";a$
  57. 540 return
  58. 550 :
  59. 560 input"file name";nf$
  60. 570 df$=left$(nf$,12)+".inv"
  61. 580 d$="0:"+df$+d$
  62. 590 open2,8,15
  63. 600 open1,8,8,d$
  64. 610 input#2,a,a$
  65. 620 if a<20 then return
  66. 630 printa$:close1:close2
  67. 640 if a-63 then input"return";a$:return
  68. 650 print"replace old file? y/n":wait k,7:get a$
  69. 660 if a$<"y" then return
  70. 670 open2,8,15,"s0:"+df$:goto 600
  71. 680 :
  72. 690 clr:input"file name";nf$
  73. 700 print"items are grouped by"
  74. 710 print"the room they are kept in."
  75. 720 gosub 740:goto 20
  76. 730 :
  77. 740 input"maximum # of rooms";i
  78. 750 input"maximum items per room";j
  79. 760 nr=i:ni=j
  80. 770 if a>i then i=a
  81. 780 if b>j then j=b
  82. 790 dim it$(i,j),id$(i,j),ag(i,j),nv(i,j),pv(i,j),nr$(i),ir(i)
  83. 800 return
  84. 810 :
  85. 820 gosub 1200
  86. 830 input"work on which room (q quit)";a$
  87. 840 a=val(a$):if a then 880
  88. 850 for i=1 to nr
  89. 860 if a$=nr$(i) then a=i
  90. 870 next
  91. 880 if a<1 or a>nr then 1650
  92. 890 if ir(a)=0 then gosub 1020
  93. 900 print:print"room"a,nr$(a),"items:"ir(a)
  94. 910 print" 0. main menu"
  95. 920 print" 1. add items"
  96. 930 print" 2. list items"
  97. 940 print" 3. item details"
  98. 950 print" 4. modify data"
  99. 960 print" 5. another room"
  100. 970 print"choice?":wait k,7:get a$:b=val(a$)
  101. 980 if b<1 then 1650
  102. 990 if b>4 then 820
  103. 1000 print:on b gosub 1040,1250,1100,1140:goto 900
  104. 1010 :
  105. 1020 if nr$(a)="" then input"name of room";nr$(a)
  106. 1030 :
  107. 1040 b=ir(a)+1:gosub 1560
  108. 1050 if b>ni then input"room is full: return";a$:return
  109. 1060 gosub 1400
  110. 1070 if a$="q" then return
  111. 1080 ir(a)=b:b=b+1:goto 1050
  112. 1090 :
  113. 1100 input"detail item # (0 quit)";b
  114. 1110 if b<1 or b>ir(a) then return
  115. 1120 gosub 1310:goto 1100
  116. 1130 :
  117. 1140 print"press return at any prompt to"
  118. 1150 print"keep the same data.":print
  119. 1160 input"modify which item # (0 quit)";b
  120. 1170 if b<1 or b>ir(a) then return
  121. 1180 gosub 1400:goto 1140
  122. 1190 :
  123. 1200 print:print"rooms",,,"items"
  124. 1210 for i=1 to nr
  125. 1220 printi,nr$(i)tab(32)ir(i)
  126. 1230 next:return
  127. 1240 :
  128. 1250 print"[147]"
  129. 1260 for i=1 to ir(a)
  130. 1270 printi;it$(a,i)
  131. 1280 next:if ir(a)>16 then input"return";a$
  132. 1290 return
  133. 1300 :
  134. 1310 print"room:",nr$(a)
  135. 1320 print"item #:",b
  136. 1330 print"descrip:",it$(a,b)
  137. 1340 print"ident:",id$(a,b)
  138. 1350 print"age, yrs:",ag(a,b)
  139. 1360 print"cost:",nv(a,b)
  140. 1370 print"value:",pv(a,b)
  141. 1380 print:return
  142. 1390 :
  143. 1400 print"[147]room:",nr$(a)
  144. 1410 print"item #"b"description (q: to quit):"
  145. 1420 printtab(2)it$(a,b)
  146. 1430 print"":inputa$
  147. 1440 if a$="q" then return
  148. 1450 it$(a,b)=a$
  149. 1460 print"id:  "id$(a,b)
  150. 1470 print"";:inputid$(a,b)
  151. 1480 print"age, yrs:",ag(a,b)
  152. 1490 print"[145]"tab(9);:inputag(a,b)
  153. 1500 print"original cost: "nv(a,b)
  154. 1510 print"[145]"tab(14);:inputnv(a,b)
  155. 1520 print"present value: "pv(a,b)
  156. 1530 print"[145]"tab(14);:inputpv(a,b)
  157. 1540 return
  158. 1550 :
  159. 1560 print"[147]for each item, give a description"
  160. 1570 print"including make, size, condition, etc."
  161. 1580 print"give an identification such as serial # or other marks."
  162. 1590 print"commas & colons not allowed as input."
  163. 1600 print"age is in years."
  164. 1610 print"cost is original price of item,"
  165. 1620 print"& estimate the current value."
  166. 1630 print"press space bar":wait k,7:get a$
  167. 1640 :
  168. 1650 ci=0:for i=1 to nr
  169. 1660 ci=ci+ir(i):next
  170. 1670 return
  171. 1680 :
  172. 1690 print"ensure printer is ready"
  173. 1700 gosub 1200
  174. 1710 input"start report at room  1[157][157][157]";s
  175. 1720 print"end report at room "nr
  176. 1730 print"[145]"tab(18);:inpute:print
  177. 1740 if s<1 or s>e or e>nr then return
  178. 1750 :
  179. 1760 print"[147]description & id may be cut to fit."
  180. 1770 print"your options:":print
  181. 1780 print"0. summarize data"
  182. 1790 print"1. short id, age & cost table"
  183. 1800 print"2. full descriptions & id's only"
  184. 1810 print"3. full report"
  185. 1820 print"4. set secondary address"
  186. 1830 print"5. cancel"
  187. 1840 print"your choice?":wait k,7:get a$:m=val(a$)
  188. 1850 if m<4 then 1900
  189. 1860 if m>4 then return
  190. 1870 print"secondary address is"sa"for upper/lower"
  191. 1880 print"case, & line feeds:":input"new value";sa:??{$7f}a0
  192. 1890 :
  193. 1900 open4,4,sa:cmd 4:print:print
  194. 1910 printchr$(14)"home inventory"
  195. 1920 print"file: "nf$
  196. 1930 t1=0:t2=0:t3=0:b$="               "
  197. 1940 for a=s to e:i=0:j=0
  198. 1950 print:printchr$(14)"room"a;nr$(a):printchr$(15)
  199. 1960 if ir(a)=0 then 2020
  200. 1970 if mand1 then print"  # description"spc(35)"id"spc(13)"age  cost value"
  201. 1980 for b=1 to ir(a)
  202. 1990 i=i+nv(a,b):j=j+pv(a,b):on m gosub 2180,2220,2160
  203. 2000 next
  204. 2010 :
  205. 2020 print"total, room"a
  206. 2030 b=ir(a):gosub 2110
  207. 2040 t1=t1+b:t2=t2+i:t3=t3+j
  208. 2050 next:print
  209. 2060 :
  210. 2070 if s=e then 2100
  211. 2080 printchr$(14)"total for rooms"s"to"e:printchr$(15)
  212. 2090 b=t1:i=t2:j=t3:gosub 2110
  213. 2100 print#4:close4:return
  214. 2110 printb$"items:"spc(8)b
  215. 2120 printb$"original cost:"i
  216. 2130 printb$"present value:"j
  217. 2140 return
  218. 2150 :
  219. 2160 if len(it$(a,b))>46 then printit$(a,b)
  220. 2170 if len(id$(a,b))>15 then printid$(a,b)
  221. 2180 printright$(b$+str$(b)+" ",4)left$(it$(a,b)+b$+b$+b$,46);
  222. 2190 printleft$(id$(a,b)+b$,15)right$(b$+str$(ag(a,b)),3);
  223. 2200 printright$(b$+str$(nv(a,b)),6)right$(b$+str$(pv(a,b)),6)
  224. 2210 return
  225. 2220 printit$(a,b):printid$(a,b):print:return
  226.